package cn.hx.mall.order.controller;

import cn.hx.mall.order.entity.OrderItem;
import cn.hx.mall.order.service.OrderService;
import cn.hx.mall.order.entity.Order;
import cn.hx.mall.order.service.OrderItemService;
import cn.hx.mall.order.service.OrderOperateHistoryService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("order")
public class OrderController {
    @Resource
    private OrderService orderService;
    @Resource
    private OrderItemService orderItemService;

    @Resource
    private OrderOperateHistoryService orderOperateHistoryService;


    @GetMapping("orderItem")
    public String order( Long id , Model map) {
        map.addAttribute("order",orderService.queryById(id));
        return "order/orderItem";
    }

    @GetMapping("/deleteOrder/{id}")
    public String delete (@PathVariable Long id){
        Order order = new Order();
        order.setId(id);
        order.setDeleteStatus(1);
        orderService.update(order);
        return "redirect:/order/orderList";
    }
    @PostMapping("/deleteOrder")
    public String delete1(Long id){
        orderService.deleteById(id);
        return "redirect:/order/orderList";
    }

    @GetMapping("orderSend")
    public String orderSend(){

        return "order/orderSend";
    }

    @PostMapping("/update/delivery")
    public String delivery(){
        return "redirect:/order/orderList";
    }

    @GetMapping("/find")
    public String find(){
        return null;
    }

    @GetMapping("/note")
    public String note(){
        return null;
    }

    @GetMapping("close")
    public String close(){
        return null;
    }


}
